<?php

/**
 * Created by JetBrains PhpStorm.
 * User: Grom Hellscream
 * Date: 11/1/12
 * Time: 8:58 PM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla modelitem library
jimport('joomla.application.component.modelitem');

/**
 * Bomaylanhdao Model
 */
class VastModelBomaylanhdao extends JModelItem {

    public function getLanhDaos()
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
                
        $query->select('a.*, b.chucdanh, c.ten AS tendonvi, d.ten AS tenphong');
        $query->from('#__hosocanbo AS a');
        $query->join('INNER', '#__congtac AS b ON b.hosocanbo_id = a.id');
        $query->join('LEFT', '#__donvi AS c ON c.id = b.donvi_id');
        $query->join('LEFT', '#__phong AS d ON d.id = b.phong_id');
        $query->where('b.lanhdao = 1');
        
        $db->setQuery($query);
        $khois = $db->loadObjectList();

        return $khois;        
    }
}